﻿
using Microsoft.AspNetCore.SignalR;

namespace Ocelot.Admin.Api.Application
{
    /// <summary>
    /// 系统服务接口
    /// </summary>
    public class ConsulApiController : IDynamicApiController
    {
        private readonly IConsulService _consulService;
        private readonly IHubContext<ConsulHub> _hubContext;

        public ConsulApiController(IConsulService consulService, IHubContext<ConsulHub> hubContext)
        {
            _consulService = consulService;
            _hubContext = hubContext;
        }

        public async Task<string> GetConsulKeyValueAsync(string key, string dc)
        {
            return await _consulService.GetConsulKeyValueAsync(key, dc);
        }

        /// <summary>
        /// 回滚
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<string> PostRollBackAsync(int id)
        {
            return await _consulService.PostRollBackAsync(id);
        }

        /// <summary>
        /// 分页查询备份信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task<SqlSugarPagedList<SettingBakResponse>> GetPageSettingBaksAsync([FromQuery]PageSettingBakRequest request)
        {
            return await _consulService.GetPageSettingBaksAsync(request);
        }
    }
}